package com.financing.wap.web.controller.tryApi;

import java.sql.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.financing.wap.common.ResultMap;
import com.financing.wap.common.ResultMap.STATUS;
import com.financing.wap.dto.RecordFbhDTO;

@Controller("fbhController")
@RequestMapping("/api/try/fbh")
public class FbhController extends BaseTryController {
	
	@RequestMapping("")
	@ResponseBody
	public ResultMap record(HttpServletRequest request, HttpServletResponse response,RecordFbhDTO rfb){
		ResultMap result = new ResultMap();
		
		try{
			rfb.setCreateDate(new Date(System.currentTimeMillis()));
		    rfb.setCreateBy(rfb.getPhone());
		    rfb.setUpdateDate(new Date(System.currentTimeMillis()));
		    rfb.setUpdateBy(rfb.getPhone());
			this.sqlMapClientTemplate.insert("fbh.addRecordFbh", rfb);
			result.setStatus(STATUS.SUCCESS);
			result.setStatusCode(ResultMap.STATUS_CODE_SUCCESS);
		}catch(Exception e){
			result.setStatus(STATUS.ERROR);
			result.setStatusCode(ResultMap.STATUS_CODE_SYS_EXCEPTION);
			log.error("fbh record error!",e);
		}
		
		return result;
	}
}
